package com.zjl.servlet;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.zjl.dao.impl.HotelDaoImpl;
import com.zjl.entity.HotelEntity;
import com.zjl.util.BaseServlet;

/**
 * Servlet implementation class StudentServlet
 */
public class HotelServlet extends BaseServlet {
	
	HotelDaoImpl sDaoImpl = new HotelDaoImpl();
	
	public void selectAll(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
		// 1 那参数
		String hotel = request.getParameter("hotel");
		ArrayList<HotelEntity> arrayList = sDaoImpl.selectAll(hotel);
		request.setAttribute("alist", arrayList);
		request.setAttribute("hotel",hotel);
		request.getRequestDispatcher("list.jsp").forward(request, response);
	}
	
	public void userDetail(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
		int id=Integer.parseInt(request.getParameter("id"));
		HotelEntity list=sDaoImpl.userDetail(id);
		  request.setAttribute("user", list);
		request.getRequestDispatcher("userDetail.jsp").forward(request, response);
		
   }
}
